import * as actionTypes from './constants';

const defaultstate = {
    maindata: [],
    num:9,
    index:0 // tabbar 那个被激活
}

const reducer = (state = defaultstate, action) => {
    switch (action.type) {
        case actionTypes.CHANGE_MAINDATA:
            return {...state, maindata: action.data }
        case actionTypes.SET_NUM:
            return {...state,num:action.data}
        case actionTypes.SET_INDEX:
            return {...state,index:action.data}
        default:
            return state;
    }
}
export default reducer;